package com.superc.lib.network.inteface.superp;

import java.io.IOException;
import java.net.Socket;
import java.util.Map;

public interface IProtocolHandler extends  Runnable {

	public void accept(Socket client) throws IOException;
	
	public void connect(String address,int port) throws IOException;
	
	public void sendCommand(Byte command,String parameter) throws IOException;
	
	public void sendCommand(Byte command,String parameter,boolean compressed) throws IOException;
	
	public void sendStream(byte[] datas,int startIndex,int length)throws IOException;
	
	public void sendStream(byte[] datas,int startIndex,int length,boolean isCompressed)throws IOException;
	
	public void addCommandDescription(byte commandId,String description);
	
	public String getCommandDescription(byte commandId);
	
	public Map<Byte,String> getCommandDescriptions();
	
	public void addCommandDescriptions(Map<Byte,String> commands);
	
	public void close();
	
	public boolean getDataCompressed();
	
	public void setDataCompressed(boolean isCompressed);
	
	public void setEventSink(IProtocolEventSink sink);
	
	public IProtocolEventSink getEventSink();
	
}
